<?php
# MantisBT - a php based bugtracking system
# Copyright (C) 2002 - 2013  MantisBT Team - mantisbt-dev@lists.sourceforge.net
# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.

form_security_validate( 'plugin_MRMailNotificationManager_email_update' );

auth_reauthenticate( );
access_ensure_global_level( config_get( 'manage_plugin_threshold' ) );

plugin_config_set('smtp', $_POST['smtp'] != null ? $_POST['smtp'] : "");
plugin_config_set('port', $_POST['port'] != null ? $_POST['port'] : "");
plugin_config_set('from', $_POST['from'] != null ? $_POST['from'] : "");
plugin_config_set('email', $_POST['email'] != null ? $_POST['email'] : "");
plugin_config_set('pass', $_POST['pass'] != null ? $_POST['pass'] : "");
plugin_config_set('subject', $_POST['subject'] != null ? $_POST['subject'] : "");

form_security_purge( 'plugin_MRMailNotificationManager_email_update' );

print_successful_redirect( plugin_page( 'email', true ) );
